<?php
/*
 * Created on 28.03.2006
 *
 *  Oeffler.com
 */

class OefPostageCalculator
{

    function calc (& $om, $id)
    {
        $count = 0;
        $cart = $om->cartArticles();
        for ($i = 0; $i < count($cart); $i++)
        {
            $count += $cart[$i]['quantity'];
        }
        $q = 3;
        $cost = 7;
        if ($count > 4)
        {
            $q = 5;
            $cost = 0;
        }
        elseif ($count < 3)
        {
            $q = 1;
            $cost = 3.9;
        }
        return array('cost' => $cost, 'quantity' => $q, 'unit' => 'Stk.');
    }

} 
 
?>
